const express = require('express');

const uuid = require('./lib/uuid');
const submit = require('./lib/submit');
const bodyParser = require('body-parser');
const operation = require('./lib/operation');
const ocr = require('./lib/router/ocr');
const purpose = require('./lib/router/purpose');
const report = require('./lib/router/report');
const upload = require('./lib/router/upload');
const analyze = require('./lib/router/analyze');

// 全局根目录位置；如果移动了该入口文件的位置，请同步修改下面的代码
global.__rootDir = __dirname;

const app = express();
const port = 3000;

app.use(express.static('public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(uuid);
app.use(submit);
app.use(operation);
app.use(ocr);
app.use(purpose);
app.use(report);
app.use(upload);
app.use(analyze);

app.listen(port, () => {
    console.log(`程序正在监听端口：${port}`);
});
